Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

248
Visualizações
JSDoc/ESLint Reporting "Unresolved variable or type" in WebStorm

I'm encountering an odd issue with some ESLint reporting in a JavaScript file. I added some JSDoc definitions like the following:

/**
 * @typedef {Object} CustomRefA
 * @property {string} attr1
 * @property {string} attr2
 * @property {Boolean} attr3
 * @property {number} attr4
 */

/**
 * @typedef {Object} CustomRefB
 * @property {string} attr5
 * @property {string} attr6
 * @property {Boolean} attr7
 * @property {CustomRefA} attr8
 */

These definitions also get used for declaring return values from functions like this:

/**
 *
 * @param {Object} params
 * @param {string} params.attrA
 * @param {string} params.attrB
 * @returns {CustomRefA}
 */
function doesSomeActionA(options) {
    return { };
}

/**
 *
 * @param {Object} params
 * @param {string} params.attrA
 * @param {CustomRefA} params.attrB
 * @returns {Object}
 */
function doesSomeActionB(params) {
    return { };
}

What I can't quite figure out, though, is why when CustomRefA is referenced ESLint reports back with:

Unresolved variable or type 'CustomRefA'

This is also causing references to attributes of any objects assigned with the custom types to be reported back as unresolved, too. This doesn't seem to happen all the time, and I haven't been able find any info to indicate any differences between projects that could explain the issue.

For reference this is in WebStorm 2021.2, with what appears to be ESLint version 7.32.0 (according to Node/NPM). And I have done quite a bit of searching on this, but haven't been able to find much in the way of results that sufficiently applied to the situation.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Are you using a scratchpad? I was having this exact issue, and still can reproduce it in a sandbox, but if i move the code over to a file in the project directory the "Unresolved variable or type 'CustomRefA'" message goes away and the file doesn't report any problems.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda